package com.iterator.controller.web.homePage;



import com.iterator.bean.web.lc.DashBoardVO;
import com.iterator.bean.web.pojo.BaseRespVo;

import com.iterator.service.web.homePage.DashBoardServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class AdminController {


    /*
    *  data Object
        errno 数值
        errmsg String
     */

 /*   @RequestMapping("admin/auth/login")
//    public BaseRespVo login(@RequestBody LoginBean loginBean)
    public BaseRespVo login(@RequestBody Map map){
        //没有使用shiro的情况下 ，返回任意的这个值就行了
        //errno = 0
        BaseRespVo<Object> baseRespVo = new BaseRespVo<>();
        baseRespVo.setErrno(0);

        baseRespVo.setData("abc");
        baseRespVo.setErrmsg("成功");
        return baseRespVo;

    }*/

    /*@RequestMapping("admin/auth/info")
    public BaseRespVo info(){
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrno(0);
        baseRespVo.setErrmsg("成功");
        HashMap<String, Object> map = new HashMap<>();
        map.put("name","admin123");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        ArrayList<String> roleList = new ArrayList<>();
        roleList.add("超级管理员");
        ArrayList<String> permList = new ArrayList<>();
        permList.add("*");

        map.put("roles",roleList);
        map.put("perms",permList);
        baseRespVo.setData(map);
        return baseRespVo;
    }*/
  /*  @RequestMapping("admin/auth/info")
    public String info(){
        String resp = "{\"errno\":0,\"data\":{\"roles\":[\"超级管理员\"],\"name\":\"admin123\",\"perms\":[\"*\"],\"avatar\":\"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif\"},\"errmsg\":\"成功\"}";
        return resp;
    }*/



    /**
     * 首页 By homePage
     * @return
     */
    @Autowired
    DashBoardServiceImpl dashBoardService;
    @RequestMapping("admin/dashboard")
    public BaseRespVo dashboard() {
        DashBoardVO dashBoardVO = dashBoardService.dashboard();
        return BaseRespVo.ok(dashBoardVO);
    }

}
